package BinaryTree;

import java.sql.SQLOutput;

public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        binaryTree.preOrder(root);
        System.out.println();
        binaryTree.inOder(root);
        System.out.println();
        binaryTree.postOder(root);
        System.out.println();
        binaryTree.preOrder2(root);
        for (int i = 0; i < binaryTree.list.size(); i++) {
            System.out.print(binaryTree.list.get(i).val);
        }
        System.out.println();
        binaryTree.nodeSize(root);
        System.out.println("节点个数1=" + binaryTree.size);
        System.out.println("节点个数2=" + binaryTree.nodeSize2(root));

        binaryTree.getLeafSize(root);
        System.out.println("叶子节点个数1=" + binaryTree.leafSize);
        System.out.println("叶子节点个数2=" + binaryTree.getLeafSize2(root));
        System.out.println("第k层个数" + binaryTree.getKlevelNodeCount(root, 3));
        System.out.println("二叉树的高度="+binaryTree.getHigh(root));
        System.out.println("检测k是否存在"+binaryTree.find(root, 'A'));
        System.out.println("检测k是否存在"+binaryTree.find(root, 'm'));
        binaryTree.levelOrder(root);
        System.out.println();
        System.out.println(binaryTree.isCompleteTree(root));
    }
}